package cn.huanzi.qch.baseadmin.test;

import redis.clients.jedis.Jedis;

public class JavaToRedis {
    public static void add(Jedis jedis,String name,int s,int e){
        for(int i=s;i<=e;i++){
            jedis.lpush(name, ""+i);
        }
    }


    public static void main(String[] args) {
        Jedis jedis=new Jedis("localhost",6379);
        jedis.del("1");
        jedis.lpush("1"," private void NumericFeild(String,int,Field.Store,boolean){\n" +
                "        this.precisonStep=precisonStep;\n" +
                "        numeriTS=new NumericTokenStream(precisonStep);\n" +
                "    }");

        jedis.lpush("1","TokenValue(){\n" +
                "        if(!isIndexed())\n" +
                "        if(nummericTS==null){\n" +
                "            numericTS=new NumericTokenStream(precisonStep);\n" +
                "            if(fieldData!=null){\n" +
                "                final Number val=(Number)fieldData;\n" +
                "            }\n" +
                "        }\n" +
                "    }");
    }
//    public static void main(String[] args) {
//        Jedis jedis=new Jedis("localhost",6379);
//        jedis.set(".Main1", "/**\n" +
//                " * DPL Main.java\n" +
//                " * @author Roberto E. Lopez-Herrejon\n" +
//                " * Main class of Draw Product Line\n" +
//                " * SEP SPL Course July 2010\n" +
//                " */\n" +
//                "import javax.swing.*;\n" +
//                "import java.awt.*;\n" +
//                "import java.awt.event.*;\n" +
//                "import java.util.Vector;\n" +
//                "@SuppressWarnings(\"serial\")\n" +
//                "public class Main extends JFrame {\n" +
//                "\t// *** Initialize constants\n" +
//                "\t// Window size\n" +
//                "\tprivate static final int WIDTH = 800;\n" +
//                "\tprivate static final int HEIGHT = 600;\n" +
//                "\t// Button names\n" +
//                "\t// Define string constants here\n" +
//                "\tprivate static final String lineText = \"Line\";\n" +
//                "\tprivate static final String rectText = \"Rectangle\";\n" +
//                "\t// Color handling\n" +
//                "\t// Use a vector to hold the names of the options\n" +
//                "\tprivate static final Vector<String> colors = new Vector<String>();\n" +
//                "\t// Declare string constants for the colors\n" +
//                "\tprivate static final String red = \"Red\";\n" +
//                "\tprivate static final String green = \"Green\";\n" +
//                "\tprivate static final String blue = \"Blue\";\n" +
//                "\tprivate static final String black = \"Black\";\n" +
//                "\t// *** Declares atomic elements\n" +
//                "\t// Declare bottons\n" +
//                "\tJButton lineButton;\n" +
//                "\tJButton rectButton;\n" +
//                "\t// Declaration for colors combo box \n" +
//                "\tJComboBox colorsBox;\n" +
//                "\t// Pane declaration. No need to use more panels or canvas.\n" +
//                "\tprotected JPanel toolPanel = new JPanel();\n" +
//                "\tprotected JPanel colorsPanel = new JPanel();\n" +
//                "\tprotected Canvas canvas = new Canvas();\n" +
//                "\t// *** Initialization of atomic elements\n" +
//                "\tpublic void initAtoms() {\n" +
//                "\t\t// Initilize the buttons\n" +
//                "\t\tlineButton = new JButton(lineText);\n" +
//                "\t\trectButton = new JButton(rectText);\n" +
//                "\t\t// Add the names of the color options here using Vector's add method\n" +
//                "\t\tcolors.add(black);\n" +
//                "\t\tcolors.add(red);\n" +
//                "\t\tcolors.add(green);\n" +
//                "\t\tcolors.add(blue);\n" +
//                "\t\t// Initilizes the values of the colors you just added\n" +
//                "\t\tcolorsBox = new JComboBox(colors);\n" +
//                "\t\t// To set a default selection use\n" +
//                "\t\tcolorsBox.setSelectedIndex(0); // sets the default to be the first entry\n" +
//                "\t\t// Hint: do not forget to set the pen color before drawing\n" +
//                "\t\t// Wraps the color box with a panel for better appearance in the tool panel\n" +
//                "\t\t// Do not change\n" +
//                "\t\tcolorsPanel.add(colorsBox);\n" +
//                "\t} // initAtoms\n" +
//                "\t// Layout components declaration\n" +
//                "\tContainer contentPane;\n" +
//                "\t/** Initializes layout . No need to change */\n" +
//                "\tpublic void initLayout() {\n" +
//                "\t\tcontentPane = getContentPane();\n" +
//                "\t\tcontentPane.setLayout(new BorderLayout());\n" +
//                "\t\ttoolPanel.setLayout(new BoxLayout(toolPanel, BoxLayout.Y_AXIS));\n" +
//                "\t}\n" +
//                "\t/** Initializes the content pane */\n" +
//                "\tpublic void initContentPane() {\n" +
//                "\t\t// Add buttons to tool panel\n" +
//                "\t\t// Note: order of addition determines the order of appearance\n" +
//                "\t\ttoolPanel.add(lineButton);\n" +
//                "\t\ttoolPanel.add(rectButton);\n" +
//                "\t\ttoolPanel.add(colorsPanel);\n" +
//                "\t\t// Adds the tool and canvas panels to the content pane\n" +
//                "\t\t// Note: No need to change the following two lines\n" +
//                "\t\tcontentPane.add(toolPanel, BorderLayout.WEST);\n" +
//                "\t\tcontentPane.add(canvas, BorderLayout.CENTER);\n" +
//                "\t} // initContentPane\n" +
//                "\t\n" +
//                "\t/** Initializes the listeners for the buttons and the combo box */\n" +
//                "\tpublic void initListeners() {\n" +
//                "\t\t\tlineButton.addActionListener(new ActionListener() {\n" +
//                "\t\tpublic void actionPerformed(ActionEvent e) {\n" +
//                "\t\t\tcanvas.selectedFigure(Canvas.FigureTypes.LINE);\n" +
//                "\t\t}\n" +
//                "\t});\n" +
//                "\t\t\t\t\trectButton.addActionListener(new ActionListener() {\n" +
//                "\t\tpublic void actionPerformed(ActionEvent e) {\n" +
//                "\t\t\tcanvas.selectedFigure(Canvas.FigureTypes.RECT);\n" +
//                "\t\t}\n" +
//                "\t});\n" +
//                "\t\t\t\t\t\t\tcolorsBox.addActionListener(new ActionListener() {\n" +
//                "\tpublic void actionPerformed(ActionEvent e)\n" +
//                "\t{\n" +
//                "\t\tif (e.getSource() == colorsBox) {\n" +
//                "\t\t\tString colorString = ((String)colorsBox.getSelectedItem());\n" +
//                "\t\t\t// colorString holds the String value of the selected item in the\n" +
//                "\t\t\t// colors box\n" +
//                "\t\t\tcanvas.setColor(colorString);\n" +
//                "\t\t}\n" +
//                "\t})\n" +
//                "}\n" +
//                "\t// Initializes entire containment hierarchy\n" +
//                "\tpublic void init() {\n" +
//                "\t\tinitAtoms();\n" +
//                "\t\tinitLayout();\n" +
//                "\t\tinitContentPane();\n" +
//                "\t\tinitListeners();\n" +
//                "\t}\n" +
//                "\t/* Constructor. No need to modify */\n" +
//                "\tpublic Main(String appTitle) {\n" +
//                "\t\tsuper(appTitle);\n" +
//                "\t\tinit();\n" +
//                "\t\taddWindowListener( new WindowAdapter() {\n" +
//                "\t\t\tpublic void windowClosing(WindowEvent e) {\n" +
//                "\t\t\t\tSystem.exit(0);\n" +
//                "\t\t\t}\n" +
//                "\t\t});\n" +
//                "\t\tsetVisible(true);\n" +
//                "\t\tsetSize(WIDTH, HEIGHT);\n" +
//                "\t\tsetResizable(true);\n" +
//                "\t\tvalidate();\n" +
//                "\t} // Main constructor\n" +
//                "\t/** main method */\n" +
//                "\tpublic static void main(String[] args) {\n" +
//                "\t\tnew Main(\"Draw Product Line\");\n" +
//                "\t}\n" +
//                "}\n");
//        jedis.del(".Main1:line");
//        add(jedis,".Main1:line",21,38);
//        add(jedis,".Main1:line",44,56);
//        add(jedis,".Main1:line",72,72);
//        add(jedis,".Main1:line",91,100);
//
//
//
//        jedis.set(".Canvas1", "/**\n" +
//                " * DPL Canvas.java\n" +
//                " * @author Roberto E. Lopez-Herrejon\n" +
//                " * SEP SPL Course July 2010\n" +
//                " */\n" +
//                "import java.awt.Color;\n" +
//                "import java.awt.Graphics;\n" +
//                "import java.awt.event.MouseEvent;\n" +
//                "import java.util.*;\n" +
//                "import java.awt.event.*;\n" +
//                "import javax.swing.JComponent;\n" +
//                "\n" +
//                "\n" +
//                "import java.awt.Point;\n" +
//                "@SuppressWarnings(\"serial\")\n" +
//                "public class Canvas extends JComponent implements MouseListener, MouseMotionListener {\n" +
//                "\t// Lists of figures objects to display\n" +
//                "\tprotected List<Line> lines = new LinkedList<Line>();\n" +
//                "\tprotected List<Rectangle> rects = new LinkedList<Rectangle>();\n" +
//                "\t// Auxiliary point\n" +
//                "\tPoint start, end;\n" +
//                "\t// Objects for creating figures to add to the canvas\n" +
//                "\tprotected Line newLine = null;\n" +
//                "\tprotected Rectangle newRect = null;\n" +
//                "\t// Enum for types of figures\n" +
//                "\tpublic enum FigureTypes { NONE \n" +
//                "\t\t,LINE\n" +
//                "\t\t,RECT\n" +
//                "\t};\n" +
//                "\t// The selected default is none. Do not change.\n" +
//                "\tpublic FigureTypes figureSelected = FigureTypes.NONE;\n" +
//                "\tprotected Color color = Color.BLACK;\n" +
//                "\t/** Sets up the canvas. Do not change */\n" +
//                "\tpublic Canvas() { \n" +
//                "\t\tthis.setDoubleBuffered(true); // for display efficiency\n" +
//                "\t\tthis.addMouseListener(this);  // registers the mouse listener\n" +
//                "\t\tthis.addMouseMotionListener(this); // registers the mouse motion listener\n" +
//                "\t}\n" +
//                "\t/** Sets the selected figure. Do not change. */\n" +
//                "\tpublic void selectedFigure(FigureTypes fig) {\n" +
//                "\t\tfigureSelected = fig;\n" +
//                "\t}\n" +
//                "\tpublic void setColor(String colorString) {\n" +
//                "\t\tif (colorString.equals(\"Red\"))\n" +
//                "\t\t\tcolor = Color.red;\n" +
//                "\t\telse if (colorString.equals(\"Green\"))\n" +
//                "\t\t\tcolor = Color.green;\n" +
//                "\t\telse if (colorString.equals(\"Blue\"))\n" +
//                "\t\t\tcolor = Color.blue;\n" +
//                "\t\telse\n" +
//                "\t\t\tcolor = Color.black;\n" +
//                "\t}\n" +
//                "\t/** Paints the component in turn. Call whenever repaint is called. */\n" +
//                "\tpublic void paintComponent(Graphics g) \t{\n" +
//                "\t\tsuper.paintComponent(g);\n" +
//                "\t\t// refreshes the canvas\n" +
//                "\t\tg.setColor(Color.WHITE);\n" +
//                "\t\tg.fillRect(0, 0, getWidth(), getHeight());\n" +
//                "\t\t// Paints the drawn figures\n" +
//                "\t\tfor (Line l : lines) { l.paint(g); }\n" +
//                "\t\tfor (Rectangle r: rects) { r.paint(g);\t}\n" +
//                "\t}\n" +
//                "\t/* Invoked when the mouse button has been clicked (pressed and released) on a component.\n" +
//                "\t * Empty implementation. Do not change.\n" +
//                "\t */\n" +
//                "\tpublic void mouseClicked(MouseEvent e)  { }// mouseClicked\n" +
//                "    /* Invoked when the mouse enters a component. Empty implementation.\n" +
//                "     * Do not change. */     \n" +
//                "\tpublic void mouseEntered(MouseEvent e) { }\n" +
//                "\t/** Invoked when the mouse exits a component. Empty implementation. \n" +
//                "\t * Do not change. */\n" +
//                "\tpublic void mouseExited(MouseEvent e) {\t}\n" +
//                "\t/** Invoked when a mouse button has been pressed on a component. */\n" +
//                "\tpublic void mousePressed(MouseEvent e) {\n" +
//                "\t\tswitch(figureSelected) {\n" +
//                "\t\t\tcase LINE : mousePressedLine(e); break;\n" +
//                "\t\t\tcase RECT: mousePressedRect(e); break;\n" +
//                "\t\t}\n" +
//                "\t}\n" +
//                "\t/** Invoked when a mouse button has been released on a component. */\n" +
//                "\tpublic void mouseReleased(MouseEvent e) {\n" +
//                "\t\tswitch(figureSelected) {\n" +
//                "\t\t\tcase LINE : mouseReleasedLine(e); break;\n" +
//                "\t\t\tcase RECT: mouseReleasedRect(e); break;\n" +
//                "\t\t}\n" +
//                "\t}\n" +
//                "\t/** Invoked when the mouse is dragged over a component */\n" +
//                "\tpublic void mouseDragged(MouseEvent e)\t{\n" +
//                "\t\tswitch(figureSelected) {\n" +
//                "\t\t\tcase LINE : mouseDraggedLine(e); break;\n" +
//                "\t\t\tcase RECT: mouseDraggedRect(e); break;\n" +
//                "\t\t}\n" +
//                "\t}\n" +
//                "\t/* Empty implementation. Do not change. */\n" +
//                "\tpublic void mouseMoved(MouseEvent e)\t{ }\n" +
//                "\t\t// **************** Manage Rect\n" +
//                "\tpublic void mousePressedRect(MouseEvent e) {\n" +
//                "\t\t// If there is no line being created\n" +
//                "\t\tif (newRect == null) {\n" +
//                "\t\t\tnewRect = new Rectangle (\n" +
//                "\t\t\t\t\tcolor,\n" +
//                "\t\t\t\t\te.getX(), e.getY());\n" +
//                "\t\t\trects.add(newRect);\n" +
//                "\t\t}\n" +
//                "\t}\n" +
//                "\t/** Updates the end point coordinates and repaints figure */\n" +
//                "\tpublic void mouseDraggedRect(MouseEvent e) {\n" +
//                "\t\tnewRect.setEnd(e.getX(), e.getY());\n" +
//                "\t\trepaint();\t\n" +
//                "\t}\n" +
//                "\t/** Clears the reference to the new line */\n" +
//                "\tpublic void mouseReleasedRect(MouseEvent e) {\n" +
//                "\t\tnewRect = null;\n" +
//                "\t}\n" +
//                "\t// **************** Manage Line\n" +
//                "\tpublic void mousePressedLine(MouseEvent e) {\n" +
//                "\t\t// If there is no line being created\n" +
//                "\t\tif (newLine == null) {\n" +
//                "\t\t\tstart = new Point(e.getX(), e.getY());\n" +
//                "\t\t\tnewLine = new Line (\n" +
//                "\t\t\t\t\tcolor,\n" +
//                "\t\t\t\t\tstart);\n" +
//                "\t\t\tlines.add(newLine);\n" +
//                "\t\t}\n" +
//                "\t}\n" +
//                "\t/** Updates the end point coordinates and repaints figure */\n" +
//                "\tpublic void mouseDraggedLine(MouseEvent e) {\n" +
//                "\t\tnewLine.setEnd(new Point(e.getX(), e.getY()));\n" +
//                "\t\trepaint();\t\n" +
//                "\t}\n" +
//                "\t/** Clears the reference to the new line */\n" +
//                "\tpublic void mouseReleasedLine(MouseEvent e) {\n" +
//                "\t\tnewLine = null;\n" +
//                "\t}\n" +
//                "} // Canvas\n");
//        jedis.del(".Canvas1:line");
//        add(jedis,".Canvas1:line",32,32);
//        add(jedis,".Canvas1:line",44,44);
//        add(jedis,".Canvas1:line",46,51);
//        add(jedis,".Canvas1:line",118,118);
//        add(jedis,".Canvas1:line",120,120);
//
//        jedis.set(".Line1","/**\n" +
//                " * DPL Line.java\n" +
//                " * @author Roberto E. Lopez-Herrejon\n" +
//                " * SEP SPL Course July 2010\n" +
//                " */\n" +
//                "import java.awt.*;\n" +
//                "/*\n" +
//                " * Note: For this class the changes you need to do relate to color handling. \n" +
//                " */\n" +
//                "public class Line {\n" +
//                "\tprivate Point startPoint, endPoint ;\n" +
//                "\tprivate Color color;\n" +
//                "\tpublic void paint(Graphics g){\n" +
//                "\t\tg.setColor(color);\n" +
//                "\t\tg.drawLine(startPoint.x, startPoint.y, endPoint.x, endPoint.y);\n" +
//                "\t}\n" +
//                "\tpublic Line(Color color, Point start) {\n" +
//                "\t\tstartPoint = start;\n" +
//                "\t\tthis.color = color;\n" +
//                "\t}\n" +
//                "\tpublic void setEnd(Point end) {\n" +
//                "\t\tendPoint = end;\n" +
//                "\t}\n" +
//                "\tpublic Point getStart() { return startPoint; }\n" +
//                "\tpublic Point getEnd () { return endPoint; }\n" +
//                "} // of Line\n");
//
//        jedis.del(".Line1:line");
//        add(jedis, ".Line1:line",12,12);
//        add(jedis, ".Line1:line",18,19);
//        add(jedis, ".Line1:line",14,14);
//    }

}
